<?php

define('IN_NETGORESP', true);

 /*
   ----------------------------------------------------------------------------------------------------
   INCLUSIONS
   ----------------------------------------------------------------------------------------------------
	+ Common.php
		- Includes all the other files needed.
   ----------------------------------------------------------------------------------------------------
   */
 include("common.php");

/*
---------------------------------------------------------------------------------------------------
QUICK SEARCH
----------------------------------------------------------------------------------------------------
	+ Give users the ability to search for someone
		- Returns list of users with same char, name, etc as entered
		- Ability to click the name and view their information
		- Happy Days.
----------------------------------------------------------------------------------------------------
*/
	if ($userrow == false) 
	{
		if(isset($_GET['q']))
		{
		
			$trimmed = mysql_real_escape_string(trim($_GET['q']));
			$before = $trimmed;
			$cleanse  = array('/','\\','\'','"',',','.','<','>','?',';',':','[',']','{','}','|','=','+','-','_',')','(','*','&','^','%','$','#','@','!','~','`');//this will remove punctuation
			$clean_search = str_replace($cleanse, '', $before);
			
			$query = searchUsers($db, $clean_search);
			$numrows=mysql_num_rows($query);
			if ($numrows == 0)
			{
				// Search Error
				$sError = $lang['sNoResults'];
				
				// @template: Header
				include("template/".$config['template_name']."/header.php");
				
				// @template: Search Error
				include("template/".$config['template_name']."/search.error.php");
				
				// @template: Footer
				include("template/".$config['template_name']."/footer.php");
			} 
			else 
			{
				// @template: Header
				include("template/".$config['template_name']."/header.php");
				
				// @template: Search Results Header
				include("template/".$config['template_name']."/search.results.php");
				
				// @template: Footer
				include("template/".$config['template_name']."/footer.php");
			}
		} 
		else 
		{
			// Search Error
			$sError = $lang['sNoQuery'];
			
			// @template: Header
			include("template/".$config['template_name']."/header.php");
			
			// @template: Search Error
			include("template/".$config['template_name']."/search.error.php");
			
			// @template: Footer
			include("template/".$config['template_name']."/footer.php");
		}
	}
	else 
	{
			// Search Error
			$sError = $lang['sNoQuery'];
			
			// @template: Header
			include("template/".$config['template_name']."/header.php");
			
			// @template: Search Error
			include("template/".$config['template_name']."/search.error.php");
			
			// @template: Footer
			include("template/".$config['template_name']."/footer.php");
	}
?>